package no.ntnu.item.ttm4115.termproject.meetingplace;

import java.util.Random;
import no.tellu.common.javaframe.messages.RoleRequestMsg;
import no.tellu.common.actorframe.messages.RoleConfirmMsg;
import no.ntnu.item.ttm4115.termproject.PositionAgentAddressToPlayer;


public class MeetingPlaceActions extends Object {

	

	public static void startupPA(MeetingPlaceSM asm){
	    // TODO edit action statements
		int id = new Random().nextInt(10000);
		asm.sendMessage(new RoleRequestMsg(String.valueOf(id)+asm.getMyActorAddress().getActorIP(), "PlayerAgent"), asm.getMyActorAddress());
	}

	public static void roleRequestPositionAgent(RoleConfirmMsg signal, MeetingPlaceSM asm){
	asm.PlayerAgentAddress= signal.getSenderRole();   
	String pos = "PositionAgent"+(int)((Math.random()*1000)+1);
	asm.sendMessage(new RoleRequestMsg(pos,"PositionAgent"), asm.getMyActorAddress());
	}

	public static void sendPositionAddress(RoleConfirmMsg signal, MeetingPlaceSM asm){
	    // TODO edit action statements
	asm.sendMessage(new PositionAgentAddressToPlayer(signal.getSenderRole()), asm.PlayerAgentAddress);
	}



}
